let xxy_bd_wrap_li = $(".xxy-bd-wrap-li")
let swap = $(".swap")
let Page = 1;

$.ajax({
    type: 'get',
    url: 'http://localhost:3000/boqishop/global',
    data: {
        Page,
    },
    dataType: 'json',
    success: function(data) {
        console.log(data);
        if (data.code) {
            let htmlStr = ''
            data.data.forEach((item) => {
                    htmlStr +=
                        `
                <li>
                    <a href="javascript:;">
                        <img src="http:${item.picpath}" alt="">
                    </a>
                </li>
            `
                })
                // xxy_bd_wrap_li.html(htmlStr);
            swap.html(htmlStr)
        }
    }
})

$('.xxy-hd-left').on('click', function() {
    Page -= 1;
    if (Page < 1) {
        Page = 70

        $.ajax({
            type: 'get',
            url: 'http://localhost:3000/boqishop/global',
            data: {
                Page,
            },
            dataType: 'json',
            success: function(data) {
                console.log(data);
                if (data.code) {
                    let htmlStr = ''
                    data.data.forEach((item) => {
                        htmlStr +=
                            `
                <li>
                    <a href="javascript:;">
                        <img src="http:${item.picpath}" alt="">
                    </a>
                </li>
                
            `
                    })
                    swap.html(htmlStr);

                }
            }
        })
    } else {
        $.ajax({
            type: 'get',
            url: 'http://localhost:3000/boqishop/global',
            data: {
                Page,
            },
            dataType: 'json',
            success: function(data) {
                console.log(data);
                if (data.code) {
                    let htmlStr = ''
                    data.data.forEach((item) => {
                        htmlStr +=
                            `
                <li>
                    <a href="javascript:;">
                        <img src="http:${item.picpath}" alt="">
                    </a>
                </li>
                
            `
                    })
                    swap.html(htmlStr);

                }
            }
        })
    }
})

$('.xxy-hd-right').on('click', function() {
    Page += 1;
    if (Page > 70) {
        Page = 1
        $.ajax({
            type: 'get',
            url: 'http://localhost:3000/boqishop/global',
            data: {
                Page,
            },
            dataType: 'json',
            success: function(data) {
                console.log(data);
                if (data.code) {
                    let htmlStr = ''
                    data.data.forEach((item) => {
                        htmlStr +=
                            `
                        <li>
                            <a href="javascript:;">
                                <img src="http:${item.picpath}" alt="">
                            </a>
                        </li>
                        
                    `
                    })
                    swap.html(htmlStr);

                }
            }
        })



    } else {
        $.ajax({
            type: 'get',
            url: 'http://localhost:3000/boqishop/global',
            data: {
                Page,
            },
            dataType: 'json',
            success: function(data) {
                console.log(data);
                if (data.code) {
                    let htmlStr = ''
                    data.data.forEach((item) => {
                        htmlStr +=
                            `
                        <li>
                            <a href="javascript:;">
                                <img src="http:${item.picpath}" alt="">
                            </a>
                        </li>
                        
                    `
                    })
                    swap.html(htmlStr);

                }
            }
        })
    }



})
$('.city').on('mouseover', function() {
    $('.ICityList').show();
    $('.city').addClass('current');
    $('.city_l p').addClass('up')
    $('.ICityList').removeClass('none')

})

$('.city').on('mouseout', function() {
    $('.ICityList').hide()
    $('.city').removeClass('current');
    $('.city_l p').removeClass('up')
    $('.ICityList').addClass('none')
})
$('.city_select a').on('click', function() {
    $('.city_select a').removeClass("current")
    $(this).addClass('current')
    console.log($(this).text())
    $(".city_l strong").text($(this).text())
})